package com.xyw.his00.controller;

import com.alipay.api.domain.People;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.xyw.his00.dto.InvoiceDTO;
import com.xyw.his00.utils.FileUtils.PayPdfUtil;
import com.xyw.his00.utils.FileUtils.PdfGeneratorUtil;
import com.xyw.his00.vo.PatientRequest;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;

import java.util.Map;

@RestController
@RequestMapping("/file/")
public class FileController {

   @RequestMapping( "registerPayInfo")//todo:registerPayInfo
   public void registerPayInfo(){

   }
   @RequestMapping( "drugPayInfo")
   public void  drugPayInfo(){

   }
   @RequestMapping( "medicalRecordInfo")
   public void  medicalRecordInfo(){

   }
   @RequestMapping( "checkInfo")
   public void  checkInfo(){

   }
   @RequestMapping( "disposalInfo")
   public void  disposalInfo(){

   }
   @RequestMapping( "inspectionInfo")
   public void  inspectionInfo(){

   }
   @RequestMapping( "drugInfo")
   public void  drugInfo(){

   }
   @RequestMapping("downloadRequestPayInfo")
   public void downloadRequestPayInfo(HttpServletRequest request, HttpServletResponse response,
                                     @RequestBody Map<String,Object> requestParams) throws Exception {
InvoiceDTO invoiceDTO = new InvoiceDTO();
for(String key:requestParams.keySet()){
    invoiceDTO =new ObjectMapper().registerModule(new JavaTimeModule()).readValue(requestParams.get(key).toString(),InvoiceDTO.class);
}
      PayPdfUtil.ExportPdf(request,response,invoiceDTO);
   }






}



